/*
 * @file iso9660_handlers.h
 *
 *  Handlers for file and directory I/O operation.
 *
 */

#ifndef __ISO9660_HANDLERS_H_
#define __ISO9660_HANDLERS_H_

#include <rtems.h>
#include <rtems/libio.h>
#include <rtems/bdbuf.h>

#include "iso9660_record.h"

int
iso9660_lookup_node_in_dir_record(
    iso9660_fs_info_t *fs,
    const char       *node,
    int                node_len,
    iso9660_record_t  *record,
    iso9660_record_t  *result
);

int
rtems_iso9660_dir_open(
  rtems_libio_t *iop,
  const char    *pathname,
  uint32_t       flag,
  uint32_t       mode
);

/**
 *  This method defines the interface to the default close(2)
 *  system call support which is provided by a file system
 *  implementation.
 */
int
rtems_iso9660_dir_close(
  rtems_libio_t *iop
);

ssize_t
rtems_iso9660_dir_read(
    rtems_libio_t   *iop,
    void            *buffer,
    size_t           count
);

ssize_t
rtems_iso9660_dir_write(
    rtems_libio_t   *iop,
    const void     *buffer,
    size_t           count
);

int
rtems_iso9660_dir_fstat(
    rtems_filesystem_location_info_t  *pathloc,
    struct stat*                      buf
);

int
iso9660_clean_identifier_length(
    iso9660_fs_info_t    *fs,
    char                *id,
    size_t               id_len
);

int
rtems_iso9660_file_open(
    rtems_libio_t   *iop,
    const char     *pathname,
    uint32_t         flag,
    uint32_t         mode
);


/**
 *  This method defines the interface to the default close(2)
 *  system call support which is provided by a file system
 *  implementation.
 */
int
rtems_iso9660_file_close(
    rtems_libio_t *iop
);

ssize_t
rtems_iso9660_file_read(
    rtems_libio_t   *iop,
    void            *buffer,
    size_t           count
);

ssize_t
rtems_iso9660_file_write(
    rtems_libio_t   *iop,
    const void     *buffer,
    size_t           count
);

int
rtems_iso9660_file_fstat(
    rtems_filesystem_location_info_t  *pathloc,
    struct stat*                      buf
);

#endif /* __ISO9660_HANDLERS_H_ */
